package com.comum.javahomework420242025.repository;

import com.comum.javahomework420242025.pojo.Area;
import com.comum.javahomework420242025.pojo.ClientCompany;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface ClientRepository extends JpaRepository<ClientCompany, Long> {
    @Query(value = "select * from clientcompany where clientcompanyname=:clientcompanyname",nativeQuery = true)
    ClientCompany existsByClientRepository(String clientcompanyname);
    @Query(value = "select * from clientcompany where " +
            "id like %:str% or clientcompanyname like %:str% or " +
            "areaname like %:str% or pet like %:str% or " +
            "diqu like %:str% or buyfield like %:str% or " +
            "credit like %:str%",nativeQuery = true)
    Page<ClientCompany> selectByStr(String str, Pageable pageable);
}
